<!--
 * @Author: 13212657520 10828485+zhaosieve@user.noreply.gitee.com~
 * @Date: 2022-05-25 19:51:56
 * @LastEditors: 13212657520 10828485+zhaosieve@user.noreply.gitee.com~
 * @LastEditTime: 2022-05-26 15:29:06
 * @FilePath: \vue-2202\src\views\news\newslist\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="newlist">
    <van-card
      v-for="v in newslist"
      :key="v.id"
      :desc="v.content"
      :title="v.title"
      :thumb="v.img_url"
      :thumb-link="'#/home/newsinfo/' + v.id"
    >
      <template #num> 阅读{{ v.click }}次 </template>
      <template #price>{{ v.add_time }}</template>
    </van-card>
  </div>
</template>
<script>
import { newsList } from "@/api";
export default {
  data() {
    return { newslist: [] };
  },
  methods: {
    async getNews() {
      const res = await newsList();
      this.newslist = res.data.message;
    },
  },
  created() {
    this.getNews();
  },
};
</script>
<style lang="scss" scoped>
.newlist {
  .van-card__content {
    min-height: 55px;
  }
  .van-card__thumb {
    height: 55px;
  }
  .van-card__title {
    font-size: 14px;
    font-weight: 600;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }
  .van-card__price {
    color: red;
  }
}
</style>
